package cn.team11.smarteye.impl;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;

import java.io.File;
import java.util.List;

import cn.team11.smarteye.bean.AlarmMsgInfoBean;
import cn.team11.smarteye.bean.ImageInfo;
import cn.team11.smarteye.contract.ImageDetailContract;
import cn.team11.smarteye.misc.SConstants;
import cn.team11.smarteye.service.CatEyeService;
import cn.team11.smarteye.utils.TimeUtils;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by Yang on 2017/11/8.
 */

public class ImageDetailPresenterImpl implements ImageDetailContract.Presenter {

    private ImageDetailContract.View mView;


    public ImageDetailPresenterImpl(ImageDetailContract.View mView) {
        this.mView = mView;
        mView.setPresenter(this);
    }


    @Override
    public void start() {

    }

    @Override
    public void destroy() {

    }

    @Override
    public ImageInfo createImageInfo(String bid, String fid, long timestamp, int type) {
        ImageInfo info = new ImageInfo();
        String dateStr = TimeUtils.times(timestamp);
        info.setDate(dateStr.substring(5, 10));
        info.setTime(dateStr.split("#")[1]);
        if (type == SConstants.ALARM_IMAGE){
            info.setUrl(CatEyeService.icvss.equesGetThumbUrl(fid, bid).toString());
        } else if (type == SConstants.GUEST_IMAGE){
            info.setUrl(CatEyeService.icvss.equesGetRingPictureUrl(fid, bid).toString());
        }
        mView.showImageInfo(info.getDate(), info.getTime(), null);
        return info;
    }
}
